<?php
namespace sycapi\wxpay\src;


use sycapi\master\Exception;
use sycapi\wxpay\base\WxpayClientBase;

class ShortUrl extends WxpayClientBase{
    protected $url = "https://api.mch.weixin.qq.com/tools/shorturl";

    protected function checkParams(){
        if($this->params["long_url"] == null )
        {
            throw new Exception("短链接转换接口中，缺少必填参数long_url！"."<br>");
        }
    }


    /**
     * 获取prepay_id
     */
    function getShortUrl(){
        $this->result = $this->postXml();
        return  isset($this->result["short_url"])?$this->result["short_url"] :false ;
    }

}